package com.karrim.server.config;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener;
import com.google.inject.servlet.ServletModule;
import com.karrim.server.GreetingServiceImpl;
import com.karrim.server.util.file.FileServlet;

/**
 *
 * @author andrea.cantafio
 */
public class GuiceWebConfigurationContextListener extends GuiceServletContextListener {
    
    @Override
    protected Injector getInjector() {
        return Guice.createInjector(new ServletModule() {
            @Override
            protected void configureServlets() {
                serve("/app/greet").with(GreetingServiceImpl.class);
                serve("/main/file").with(FileServlet.class);
            }
        });
    }
}
